Image correction method, terminal device and storage medium

ABSTRACT

An image correction method, a terminal device and a non-transitory computer readable storage medium are provided. The method includes: extracting human face attributes of an image; acquiring, from target regions, a first region having a human face correction attribute; acquiring, from the target regions, a second region having a human face protection attribute; and performing image correction on the human face in the first region, and performing pixel compensation, according to background pixels of the image, on a blank region generated by the image correction in the first region.

CROSS-REFERENCE TO RELATED APPLICATIONS

The present disclosure is a continuation of International ApplicationNo. PCT/CN2020/129243, filed on Nov. 17, 2020, which claims priority toChinese Patent Application No. 201911252839.3, filed on Dec. 9, 2019,the entire disclosures of which are incorporated herein by reference.

TECHNICAL FIELD

The present disclosure relates to the field of image processingtechnologies, and in particularly, to an image correction method, aterminal device and a storage medium.

BACKGROUND

At present, a terminal device is equipped with a wide-angle camera. Animage captured by the wide-angle camera is always been distorted, and adistorted degree of the image is usually expressed by a distortioncoefficient.

SUMMARY

The present disclosure proposes an image correction method, a terminaldevice and a storage medium.

In one aspect, an embodiment of the present disclosure provides an imagecorrection method, the method includes: human face attributes of targetregions of respective human faces in an image are extracted; a firstregion having a human face correction attribute is acquired from thetarget regions based on the human face attributes; a second regionhaving a human face protection attribute is acquired from the targetregions based on the human face attributes; and an image correction isperformed on the human face in the first region, and a pixelcompensation is performed, based on background pixels of the image, on ablank region generated by the image correction in the first region; thebackground pixels of the image do not include any pixel in the secondregion.

In another aspect, an embodiment of the present disclosure provides aterminal device, including a memory, a processor and a computer programstored in the memory and executable by the processor, the processor isconfigured, when executing the computer program, to realize the imagecorrection method. The image correction method includes human faceattributes of target regions of respective human faces in an image areextracted; a first region having a human face correction attribute isacquired from the target regions based on the human face attributes; asecond region having a human face protection attribute is acquired fromthe target regions based on the human face attributes; and an imagecorrection is performed on the human face in the first region; and apixel compensation is performed, based on background pixels of theimage, on a blank region generated by the image correction in the firstregion; the background pixels of the image are not any pixel in thesecond region.

In another aspect, an embodiment of the present disclosure provides anon-transitory computer readable storage medium stored with a computerprogram thereon, the computer program, when is executed by a processor,causes the processor to realize the image correction method. The imagecorrection method includes: human face attributes of target regions ofrespective human faces in an image are extracted; a first region havinga human face correction attribute is acquired from the target regionsbased on the human face attributes; a second region having a human faceprotection attribute is acquired from the target regions based on thehuman face attributes; and an image correction is performed on the humanface in the first region; and a pixel compensation is performed, basedon background pixels of the image, on a blank region generated by theimage correction in the first region; the background pixels of the imageare not any pixel in the second region.

The additional aspects and advantages of the present disclosure will begiven in the following description, and some will become obvious fromthe following description, or learned through the practice of thepresent disclosure.

BRIEF DESCRIPTION OF THE DRAWINGS

The above and/or additional aspects and advantages of the presentdisclosure will become apparent and easy to understand from thefollowing description of embodiments in combination with theaccompanying drawings, wherein:

FIG. 1 illustrates a flowchart of an image correction method accordingto an embodiment of the present disclosure.

FIG. 2 illustrates a flowchart of an image correction method accordingto another embodiment of the present disclosure.

FIG. 3 illustrates a schematic structural view of an image correctionapparatus according to an embodiment of the present disclosure.

FIG. 4 illustrates a schematic structural view of an image correctionapparatus according to another embodiment of the present disclosure.

DETAILED DESCRIPTION OF EMBODIMENTS

Embodiments of the present disclosure are described in detail below, andexamples of the embodiments are shown in the drawings, the same orsimilar reference numerals throughout represent the same or similarelements or elements with the same or similar functions. The embodimentsdescribed below with reference to the accompanying drawings areexemplary and are intended to explain the present disclosure and cannotbe understood as limitations to the present disclosure.

As shown in FIG. 1, an image correction method of an embodiment of thepresent disclosure includes:

-   -   extracting human face attributes of standard regions (also        referred to target regions) of respective human faces in an        image;    -   acquiring, based on the human face attributes, a first region        having a human face correction attribute from the standard        regions;    -   acquiring, based on the human face attributes, a second region        having a human face protection attribute from the standard        regions; and    -   performing an image correction on the human face in the first        region; and performing a pixel compensation, based on background        pixels of the image, on a blank region generated by the image        correction in the first region;    -   the background pixels of the image do not include any pixel in        the second region.

In some illustrated embodiments, the extracting human face attributes ofstandard regions of respective human faces in an image, includes:

-   -   detecting human face frames (also referred to human face        bounding box) of the respective human faces in the image, and        demarcating, based on a preset algorithm, the standard regions        of the human faces from the respective human face frames;    -   obtaining a human face area of each of the standard regions; and    -   obtaining a human-face radial distance of each of the standard        regions, from a central point coordinate of each of the human        face frames to a central coordinate of the image.

As shown in FIG. 2, in some illustrated embodiments, the acquiring,based on the human face attributes, a first region having a human facecorrection attribute from the standard regions, includes:

-   -   comparing the human face area of each of the standard regions        with a preset first area threshold, and comparing the human-face        radial distance of each of the standard regions with a preset        first distance threshold; and    -   determining, based on comparing results, the standard region        corresponding to at least one of the human face area being        greater than the first area threshold and the human-face radial        distance being greater than the first distance threshold as the        first region having the human face correction attribute.

In some illustrated embodiments, the acquiring, based on the human faceattributes, a second region having a human face protection attributefrom the standard regions, includes:

-   -   comparing the human face area of each of the standard regions        with a preset second area threshold, and comparing the        human-face radial distance of each of the standard regions with        a preset second distance threshold, the first area threshold        being greater than the second area threshold, and the first        distance threshold being greater than the second distance        threshold; and    -   determining, based on comparing results, the standard region        corresponding to the human face area less than the first area        threshold and greater than the second area threshold, and the        human-face radial distance less than the first distance        threshold and greater than the second distance threshold as the        second region having the human face protection attribute.

In some illustrated embodiments, the image correction method furtherincludes: determining, based on the comparing results, the standardregion corresponding to the human face area less than the second areathreshold and the human-face radial distance less than the seconddistance threshold as a third region having a human face backgroundattribute.

The performing a pixel compensation, based on background pixels of theimage, on a blank region generated by the image correction in the firstregion, includes:

-   -   performing the pixel compensation, based on pixels in the third        region having the human face background attribute around the        first region, on the blank region generated by the image        correction in the first region.

As shown in FIG. 3, an image correction apparatus of an embodiment ofthe present disclosure includes an extracting module 310, a firstacquiring module 320, a second acquiring module 330 and a correctionmodule 340. The extracting module 310 is configured to extract humanface attributes of standard regions of respective human faces in animage. The first acquiring module 320 is configured to acquire, based onthe human face attributes, a first region having a human face correctionattribute from the standard regions. The second acquiring module 330 isconfigured to acquire, based on the human face attributes, a secondregion having a human face protection attribute from the standardregions. The correction module 340 is configured to perform an imagecorrection on the human face in the first region; and perform a pixelcompensation, based on background pixels of the image, on a blank regiongenerated by the image correction in the first region; the backgroundpixels of the image are not any pixel in the second region.

As shown in FIG. 4, in some illustrated embodiments, the extractingmodule 310 includes: a detecting unit 3101, a first calculating unit3102, and a second calculating unit 3103. The detecting unit 3101 isconfigured to detect human face frames of the respective human faces inthe image, and demarcate, based on a preset algorithm, the standardregions of the human faces in the respective human face frames. Thefirst calculating unit 3102 is configured to obtain a human face area ofeach of the standard regions. The second calculating unit 3103 isconfigured to obtain a human-face radial distance of each of thestandard regions, from a central point coordinate of each of the humanface frames to a central coordinate of the image.

In some illustrated embodiments, the first acquiring module 320 isconfigured concretely to: compare the human face area of each of thestandard regions with a preset first area threshold, and compare thehuman-face radial distance of each of the standard regions with a presetfirst distance threshold; determine, based on compare results, thestandard region corresponding to at least one of the human face areabeing greater than the first area threshold and the human-face radialdistance being greater than the first distance threshold as the firstregion having the human face correction attribute.

In some illustrated embodiments, the second acquiring module 330 isconfigured concretely to: compare the human face area of each of thestandard regions with a preset second area threshold, and compare thehuman-face radial distance of each of the standard regions with a presetsecond distance threshold; the first area threshold being greater thanthe second area threshold, and the first distance threshold beinggreater than the second distance threshold; determine, based on compareresults, the standard region corresponding to the human face area lessthan the first area threshold and greater than the second area thresholdand the human-face radial distance less than the first distancethreshold and greater than the second distance threshold as the secondregion having the human face protection attribute.

In some illustrated embodiments, the standard region corresponding tothe human face area less than the second area threshold and thehuman-face radial distance less than the second distance threshold isdetermined, based on the compare results, as a third region having ahuman face background attribute. The correction module 340 is configuredconcretely to: perform the pixel compensation, based on pixels in thethird region having the human face background attribute around the firstregion, on the blank region generated by the image correction in thefirst region.

A terminal device of an embodiment of the present disclosure includes amemory, a processor and a computer program stored in the memory andexecutable by the processor. The processor is configured, when executingthe computer program, to: extract human face attributes of standardregions of respective human faces in an image; acquire, based on thehuman face attributes, a first region having a human face correctionattribute from the standard regions; acquire, based on the human faceattributes, a second region having a human face protection attributefrom the standard regions; and perform an image correction on the humanface in the first region; and perform a pixel compensation, based onbackground pixels of the image, on a blank region generated by the imagecorrection in the first region. The background pixels of the image arenot any pixel in the second region.

In some illustrated embodiments, the processor is configured concretely,when executing the computer program, to: detect human face frames of therespective human faces in the image, and demarcate, based on a presetalgorithm, the standard regions of the human faces in the respectivehuman face frames; obtain a human face area of each of the standardregions; and obtain a human-face radial distance of each of the standardregions, from a central point coordinate of each of the human faceframes to a central coordinate of the image.

In some illustrated embodiments, the processor is configured concretely,when executing the computer program, to: compare the human face area ofeach of the standard regions with a preset first area threshold, andcompare the human-face radial distance of each of the standard regionswith a preset first distance threshold; determine, based on compareresults, the standard region corresponding to at least one of the humanface area being greater than the first area threshold and the human-faceradial distance being greater than the first distance threshold as thefirst region having the human face correction attribute.

In some illustrated embodiments, the processor is configured concretely,when executing the computer program, to: compare the human face area ofeach of the standard regions with a preset second area threshold, andcompare the human-face radial distance of each of the standard regionswith a preset second distance threshold; the first area threshold beinggreater than the second area threshold, and the first distance thresholdbeing greater than the second distance threshold; determine, based oncompare results, the standard region corresponding to the human facearea less than the first area threshold and greater than the second areathreshold and the human-face radial distance less than the firstdistance threshold and greater than the second distance threshold as thesecond region having the human face protection attribute.

In some illustrated embodiments, the processor is configured, whenexecuting the computer program, to: determine, based on the compareresults, the standard region corresponding to the human face area lessthan the second area threshold and the human-face radial distance lessthan the second distance threshold as a third region having a human facebackground attribute; perform the pixel compensation, based on pixels inthe third region having the human face background attribute around thefirst region, on the blank region generated by the image correction inthe first region.

An embodiment of the present disclosure provides a non-transitorycomputer readable storage medium stored with a computer program thereon,the computer program, when is executed by a processor, causes theprocessor to: extract human face attributes of standard regions ofrespective human faces in an image; acquire, based on the human faceattributes, a first region having a human face correction attribute fromthe standard regions; acquire, based on the human face attributes, asecond region having a human face protection attribute from the standardregions; and perform an image correction on the human face in the firstregion; and perform a pixel compensation, based on background pixels ofthe image, on a blank region generated by the image correction in thefirst region. The background pixels of the image are not any pixel inthe second region.

In some illustrated embodiments, the computer program, when is executedby the processor, causes the processor to: detect human face frames ofthe respective human faces in the image, and demarcate, based on apreset algorithm, the standard regions of the human faces in therespective human face frames; obtain a human face area of each of thestandard regions; and obtain a human-face radial distance of each of thestandard regions, from a central point coordinate of each of the humanface frames to a central coordinate of the image.

In some illustrated embodiments, the computer program, when is executedby the processor, causes the processor to: compare the human face areaof each of the standard regions with a preset first area threshold, andcompare the human-face radial distance of each of the standard regionswith a preset first distance threshold; determine, based on compareresults, the standard region corresponding to at least one of the humanface area being greater than the first area threshold and the human-faceradial distance being greater than the first distance threshold as thefirst region having the human face correction attribute.

In some illustrated embodiments, the computer program, when is executedby the processor, causes the processor to: compare the human face areaof each of the standard regions with a preset second area threshold, andcompare the human-face radial distance of each of the standard regionswith a preset second distance threshold; the first area threshold beinggreater than the second area threshold, and the first distance thresholdbeing greater than the second distance threshold; determine, based oncompare results, the standard region corresponding to the human facearea less than the first area threshold and greater than the second areathreshold and the human-face radial distance less than the firstdistance threshold and greater than the second distance threshold as thesecond region having the human face protection attribute.

In some illustrated embodiments, the computer program, when is executedby the processor, causes the processor to: determine, based on thecompare results, the standard region corresponding to the human facearea less than the second area threshold and the human-face radialdistance less than the second distance threshold as a third regionhaving a human face background attribute; perform the pixelcompensation, based on pixels in the third region having the human facebackground attribute around the first region, on the blank regiongenerated by the image correction in the first region.

The image correction method and apparatus, terminal device and storagemedium of the embodiments of the present disclosure are described belowwith reference to the accompanying drawings. An application subject ofthe image correction method of the embodiment of the present disclosurecan be any terminal device with a camera.

In order to solve a technical problem that in a current terminal device,only one camera is calibrated with a set of distortion coefficients toobtain an image that needs distortion correction, and a globaloptimization method is used to de distort the image, which leads tocorrect a target object that does not need to be corrected, and thusaffects a correction processing efficiency and a correction processingeffect, the present disclosure provides an image correction method. Inan embodiment of the present disclosure, human face attributes ofstandard regions corresponding to respective human faces in an image isextracted, a first region having a human face correction attribute isobtained from the standard regions based on the human face attributes, asecond region having a human face protection attribute is obtained fromthe standard regions based on the human face attributes, and a humanface in the first region is performed image correction, a blank regiongenerated by the image correction in the first region is performed pixelcompensation based on background pixels of the image, in which thebackground pixels of the image do not include any pixel in the secondregion. Therefore, the pixel compensation of the blank region generatedby the image correction process is realized through the backgroundpixels of the image, so as to improve the correction processingefficiency of the image and ensure the correction processing effect ofthe image.

An image correction method according to an embodiment of the presentdisclosure is described below with reference to the accompanyingdrawings.

FIG. 1 is a flowchart of an image correction method according to anembodiment of the present disclosure. As shown in FIG. 1, the method maybegin from block 101 to block 104.

At block 101, extracting human face attributes of standard regions ofrespective human faces in an image.

Specifically, the image correction method of the present disclosure ismainly a correction for a distortion of a human face in the image. Itcan be understood that there can be one or more human faces in anactually captured image, and the human face can be a front face, a sideface, a half face, etc. in the case of multiple human faces, the presentdisclosure can distinguish the multiple human faces into a human facerequiring distortion correction, a human face requiring protection andnot being processed as a background, as well as a human face that can beused as the background. During the correction, the human face requiringdistortion correction can be processed and the human face requiringprotection can be protected, which reduces unnecessary face correctionand ensures that the face requiring protection will not be stretched anddeformed.

The standard region refers to an accurate region of the human face,which can be selected and adjusted according to needs of a practicalapplication. The human face attribute can include a human face area, anda distance between the human face and a center of the image (alsoreferred to as human-face radial distance), etc.

It is understandable that there are many ways to obtain the standardregion of the human face, for an example, directly obtaining thestandard region of the human face through a human face detectionalgorithm, for another example, obtaining a human body region through aninstance segmentation algorithm, and then obtaining a human face regionfrom the human body region as the standard region of the human face, forstill another example, a human face frame obtained by a human facedetection algorithm and a human body region obtained by a instancesegmentation algorithm can be superimposed to obtain the standard regionof the human face. As a possible implementation, detecting human faceframes of the respective human faces in the image, and demarcating,based on a preset algorithm, the standard regions of the human faces inthe respective human face frames; obtaining a human face area of eachstandard region; and obtaining a human-face radial distance of eachstandard region, from a central point coordinate of each human faceframe to a central coordinate of the image.

At block 102, acquiring, based on the human face attributes, a firstregion having a human face correction attribute from the standardregions.

At block 103, acquiring, based on the human face attributes a secondregion having a human face protection attribute from the standardregions.

It can be understood that each human face in the image has acorresponding standard region, the human face attribute of each standardregion is extracted, a preset determination strategy is selected todetermine each human face attribute, the standard region having thehuman face correction attribute can be obtained from the standardregions as the first region, and the standard region having the humanface protection attribute can be obtained from the standard regions asthe second region. The preset determination strategy can be selected andadjusted according to the needs of the practical application. The humanface attribute may include the human face area and the distance betweenthe human face and the center of the image, examples are as follows.

In a first example, the human face area is compared with a preset firstarea threshold, a human-face radial distance is compared with a presetfirst distance threshold, and the standard region corresponding to atleast one of the human face area being greater than the first areathreshold and the human-face radial distance being greater than thefirst distance threshold is determined, based on compare results, as thefirst region having the human face correction attribute.

In a second example, the human face area is compared with a presetsecond area threshold, and the human-face radial distance is comparedwith a preset second distance threshold, and the first area threshold isgreater than the second area threshold, and the first distance thresholdis greater than the second distance threshold, and the standard regioncorresponding to the human face area less than the first area thresholdand greater than the second area threshold and the human-face radialdistance less than the first distance threshold and greater than thesecond distance threshold is determined, based on compare results, asthe second region having the human face protection attribute.

At block 104, performing an image correction on the human face in thefirst region; and performing a pixel compensation, based on backgroundpixels of the image, on a blank region generated by the image correctionin the first region. The background pixels of the image do not includeany pixel in the second region.

In an illustrated embodiment, after determining the human face of thefirst region that needs de distortion correction and the human face ofthe second region that needs to be protected and not processed as thebackground, the human face of the first region is performed imagecorrection, and the blank region generated by the image correction inthe first region is performed the pixel compensation based on thebackground pixels of the image, the background pixels of the image donot include any pixel in the second region.

That is, in the process of image de distortion, the human face of thefirst region needs to be adjusted. After the adjustment, there will bethe blank region, which needs to be processed by interpolationcompensation. For example, after a human face with a circular in thefirst region is corrected to a human face with an ellipse, the blackregion is generated and is performed pixel compensation through thebackground pixel of the image excluding the pixels in the second region,which makes it possible to process the human face that need to becorrected and protect the human face that need to be protected duringthe distortion correction, reduces the unnecessary human face correctionand avoids the stretching deformation of the protected human face as thebackground.

To sum up, the image correction method of the embodiment of the presentdisclosure extracts the human face attributes of the standard regionscorresponding to the respective human faces in the image, obtains, basedon the human face attributes, the first region having the human facecorrection attribute from the standard regions, obtains, based on thehuman face attributes, the second region having the human faceprotection attribute from the standard regions, performs imagecorrection on the human face in the first region, and performs pixelcompensation, based on the background pixels of the image, on the blankregion generated by the image correction in the first region, thebackground pixels of the image do not include any pixel in the secondregion, which solves the technical problem of affecting a correctionprocess efficiency and a correction process effect caused by correctinga target object that does not need to be corrected in the related art,realizes the pixel compensation for the blank region generated by theimage correction through the background pixels of the image, improvesthe correction process efficiency of the image and ensures thecorrection process effect of the image.

In order to more clearly describe the above embodiment, it will bedescribed in detail below in combination with FIG. 2. As shown in FIG.2, the method may begin from block 201 to block 208.

At block 201, detecting human face frames of the respective human facesin the image, and demarcating, based on a preset algorithm, the standardregions of the human faces in the respective human face frames.

Specifically, the human face frames of the respective human faces can beobtained by detecting human faces of the image. In order to obtain thestandard regions corresponding to the human faces, the standard regionsof the human faces can be determined by preset algorithms such as entitysegmentation or semantic segmentation combined with the human faceframes.

For example, objects are separated from a background by the entitysegmentation, and then pixels of the detected objects are extracted, andthe detected objects are classified. In a general example, in thesegmentation results, mask pixel values of non-human region are 0, andmask pixel values of different human regions correspond to differentnon-zero values respectively.

In an illustrated embodiment, the human face frame of each human face isobtained and determining whether there is an instance segmented humanbody region in the human face frame. If there is only an instancesegmentation result of one human body region in the human face frame, apart corresponding the human body mask in the human face frame is foundas the standard region of the human face; and if there are instancesegmentation results of multiple human body regions in the human faceframe, the segmentation result of the human body region with the largestregion in the human face frame is taken as the standard region of thehuman face.

At block 202, obtaining a human face area of each of the standardregions; and obtaining a human-face radial distance of each of thestandard regions, from a central point coordinate of each of the humanface frames to a central coordinate of the image.

At block 203, comparing the human face area of each of the standardregions with a preset first area threshold, and comparing the human-faceradial distance of each of the standard regions with a preset firstdistance threshold.

At block 204, determining, based on comparing results, the standardregion corresponding to at least one of the human face area beinggreater than the first area threshold and the human-face radial distancebeing greater than the first distance threshold as the first regionhaving the human face correction attribute.

At block 205, comparing the human face area of each of the standardregions with a preset second area threshold, and comparing thehuman-face radial distance of each of the standard regions with a presetsecond distance threshold; the first area threshold is greater than thesecond area threshold, and the first distance threshold is greater thanthe second distance threshold.

At block 206, determining, based on comparing results, the standardregion corresponding to the human face area less than the first areathreshold and greater than the second area threshold and the human-faceradial distance less than the first distance threshold and greater thanthe second distance threshold as the second region having the human faceprotection attribute.

Specifically, firstly, the human face area of each standard region isobtained, such as an overlapping part of the human image region obtainedby semantic segmentation or instance segmentation and the human facerectangle frame obtained by the face detection is obtained. Then thehuman-face radial distance from the central point coordinate of eachhuman face frame to the central coordinate of the image is obtained. Forexample, the central point coordinate of the human face can becalculated according to coordinates of the four vertices of the humanface frame obtained by face detection, and the human-face radialdistance can be obtained by calculating a radial distance from thecentral point coordinate of the human face frame to the center of theimage.

In an illustrated embodiment, in response to one of the human face areabeing greater than the first area threshold, the human-face radialdistance being greater than the first distance threshold, and the humanface area being greater than the first area threshold and the human-faceradial distance being greater than the first distance threshold, thecorresponding standard region is the first region having the human facecorrection attribute.

In response to the human face area is less than the first area thresholdand greater than the second area threshold and the human-face radialdistance is less than the first distance threshold and greater than thesecond distance threshold, the corresponding standard region is thesecond region having the human face protection attribute. The first areathreshold is greater than the second area threshold, and the firstdistance threshold is greater than the second distance threshold. Thefirst area threshold, the second area threshold, the first distancethreshold and the second distance threshold can be selected and setaccording to the needs of practical application.

At block 207, determining, based on the comparing results, the standardregion corresponding to the human face area less than the second areathreshold and the human-face radial distance less than the seconddistance threshold as a third region having a human face backgroundattribute.

At block 208, performing the pixel compensation, based on pixels in thethird region having the human face background attribute around the firstregion, on the blank region generated by the image correction in thefirst region.

Specifically, it is determined that the standard region corresponding tothe human face area less than the second area threshold and thehuman-face radial distance less than the second distance threshold isthe third region having face background attribute, that is, the thirdarea corresponding to the human face as the background.

It should be noted that a division mode of the first region, the secondregion and the third region can be selected and adjusted according tothe specific application.

It should be noted that in the description of the above embodiment, ifthere is no instance segmentation result of the human body region in thehuman face frame, it is considered that the credibility of the humanface frame is low, and the standard region corresponding to the humanface is determined as the third region with the human face backgroundattribute.

Thus, in the correction process, the human face requiring the distortioncorrection is corrected, the human face requiring protection isprotected, the human face that can be used as the background is used asthe background, and the pixel compensation is performed for the blankregion generated by the image correction in the first region based onthe pixels in the third region having the human face backgroundattribute around the first region.

Therefore, by introducing the human face attributes, integrating thehuman face detection results and instance segmentation results, as wellas each human face area size and each human-face radial distance, it cancalculate whether each human face needs to be corrected, protected orused as the background, thereby each human face in the final correctionresult can get a better processing effect.

To sum up, the image correction method of the embodiment of the presentdisclosure detects the human face frame of each human face in the image,demarcates, based on the preset algorithm, the standard regions of thehuman faces from the human face frames, obtains the human face area ofeach standard region, obtains the human-face radial distance of eachstandard region from the central point coordinate of each human faceframe to the central coordinate of the image, and compares the humanface area with the first area threshold, and compares the human-faceradial distance with the first distance threshold, determines, based oncompare results, the standard region corresponding to the human facearea greater than the first area threshold and/or the human-face radialdistance greater than the first distance threshold as the first regionhaving the human face correction attribute, determines, based on thecompare results, the standard region corresponding to the human facearea less than the first area threshold and greater than the second areathreshold and the human-face radial distance less than the firstdistance threshold and greater than the second distance threshold as thesecond region having the human face protection attribute, determines,based on the compare results, the standard region corresponding to thehuman face area less than the second area threshold and the human-faceradial distance less than the second distance threshold as the thirdregion having the human face background attribute, and performs thepixel compensation, based on the pixels in the third region having thehuman face background attribute around the first region, on the blankregion generated by the image correction in the first region, whichsolves the technical problems that in the related art, the distortion ofdifferent regions on the image cannot be accurately obtained, and thecorrection processing efficiency and correction processing effect areaffected by correcting the target object that does not need to becorrected, and realizes different processing according to the specificdistortion of different regions of the image, the pixels in the thirdregion having the human face background attribute around the firstregion are used to compensate the blank region generated by the imagecorrection in the first region, thereby to improve the correctionprocess efficiency of image and ensure the de distortion process effect.

In order to realize the above embodiment, the present disclosure furtherprovides an image correction apparatus. FIG. 3 illustrates a schematicstructural view of an image correction apparatus according to anembodiment of the present disclosure. As shown in FIG. 3, the imagecorrection apparatus may include an extracting module 310, a firstacquiring module 320, a second acquiring module 330 and a correctionmodule 340.

The extracting module 310 is configured to extract human face attributesof standard regions of respective human faces in an image.

The first acquiring module 320 is configured to acquire, based on thehuman face attributes, a first region having a human face correctionattribute from the standard regions.

The second acquiring module 330 is configured to acquire, based on thehuman face attributes, a second region having a human face protectionattribute from the standard regions.

The correction module 340 is configured to perform an image correctionon the human face in the first region, and perform a pixel compensation,based on background pixels of the image, on a blank region generated bythe image correction in the first region. The background pixels of theimage are not any pixel in the second region.

In an illustrated embodiment, as shown in FIG. 4, on the basis of FIG.3, the extracting module 310 may include: a detecting unit 3101, a firstcalculating unit 3102, and a second calculating unit 3103.

The detecting unit 3101 is configured to detect human face frames of therespective human faces in the image, and demarcate, based on a presetalgorithm, the standard regions of the human faces in the respectivehuman face frames.

The first calculating unit 3102 is configured to obtain a human facearea of each of the standard regions.

The second calculating unit 3103 is configured to obtain a human-faceradial distance of each of the standard regions, from a central pointcoordinate of each of the human face frames to a central coordinate ofthe image.

In an illustrated embodiment, the first acquiring module 320 isconfigured concretely to: compare the human face area of each of thestandard regions with a preset first area threshold, and compare thehuman-face radial distance of each of the standard regions with a presetfirst distance threshold; and determine, based on compare results, thestandard region corresponding to at least one of the human face areabeing greater than the first area threshold and the human-face radialdistance being greater than the first distance threshold as the firstregion having the human face correction attribute.

In an illustrated embodiment, the second acquiring module 330 isconfigured concretely to: compare the human face area of each of thestandard regions with a preset second area threshold, and compare thehuman-face radial distance of each of the standard regions with a presetsecond distance threshold; the first area threshold being greater thanthe second area threshold, and the first distance threshold beinggreater than the second distance threshold; and determine, based oncompare results, the standard region corresponding to the human facearea less than the first area threshold and greater than the second areathreshold and the human-face radial distance less than the firstdistance threshold and greater than the second distance threshold as thesecond region having the human face protection attribute.

In an illustrated embodiment, the standard region corresponding to thehuman face area less than the second area threshold and the human-faceradial distance less than the second distance threshold is determined,based on the compare results, as a third region having a human facebackground attribute. The correction module 340 is configured concretelyto: perform the pixel compensation, based on pixels in the third regionhaving the human face background attribute around the first region, onthe blank region generated by the image correction in the first region.

It should be noted that the above description of the image correctionmethod is also applicable to the image correction apparatus of theembodiment of the present disclosure. Its implementation principle issimilar and will not be repeated here.

To sum up, the image correction apparatus of the embodiment of thepresent disclosure extracts the human face attributes of the standardregions corresponding to the respective human faces in the image,obtains, based on the human face attributes, the first region having thehuman face correction attribute from the standard regions, obtains,based on the human face attributes, the second region having the humanface protection attribute from the standard regions, performs imagecorrection on the human face in the first region; and performs pixelcompensation, based on the background pixels of the image, on the blankregion generated by the image correction in the first region, thebackground pixels of the image are not any pixel in the second region,which solves the technical problem of affecting a correction processefficiency and a correction process effect caused by correcting a targetobject that does not need to be corrected in the related art, realizesthe pixel compensation for the blank region generated by the imagecorrection process through the background pixels of the image, improvesthe correction process efficiency of the image and ensures thecorrection process effect of the image.

In order to realize the above embodiment, the present disclosure furtherprovides a terminal device, including: a memory, a processor, and acomputer program stored in the memory and executable by the processor.the processor is configured, when executing the computer program, torealize the image correction method described in the above embodiment.

In order to realize the above embodiments, the present disclosurefurther provides a non-transitory computer readable storage mediumstored with a computer program thereon. The computer program, when isexecuted by a processor, causes the processor to realize the imagecorrection method described in the above embodiments.

Reference throughout this specification to “an embodiment”, “someembodiments”, “an example”, “a specific example” or “some examples”means that particular features, structures, materials, orcharacteristics described in connection with the embodiments or examplesare included in at least one embodiment or example of the presentdisclosure. Thus, the appearances of the above phrases throughout thisspecification are not necessarily referring to the same embodiment orexample of the present disclosure. Furthermore, the particular features,structures, materials, or characteristics may be combined in anysuitable manner in one or more embodiments or examples. In addition,without contradiction, those skilled in the art can compose or combinethe different embodiments or examples described in this specificationand the features of different embodiments or examples.

In addition, terms such as “first” and “second” are used herein forpurposes of description and are not intended to indicate or implyrelative importance or significance or to imply the number of indicatedtechnical features. Thus, a feature defined as “first” and “second” maycomprise one or more of this feature. In the description of the presentdisclosure, “multiple” means “two or more than two”, unless otherwisespecified.

Any process or method described in a flow chart or described herein inother ways may be understood to include one or more modules, segments orportions of codes of executable instructions for achieving specificlogical functions or steps in the process, and the scope of a preferredembodiment of the present disclosure includes other implementations, inwhich it should be understood by those skilled in the art that functionsmay be implemented in a sequence other than the sequences shown ordiscussed, including in a substantially identical sequence or in anopposite sequence.

The logic and/or step described in other manners herein or shown in theflow chart, for example, a particular sequence table of executableinstructions for realizing the logical function, may be specificallyachieved in any computer readable medium to be used by the instructionsexecution system, device or equipment (such as a system based oncomputers, a system comprising processors or other systems capable ofobtaining instructions from the instructions execution system, deviceand equipment executing the instructions), or to be used in combinationwith the instructions execution system, device and equipment. As to thespecification, “the computer readable medium” may be any device adaptivefor including, storing, communicating, propagating or transferringprograms to be used by or in combination with the instruction executionsystem, device or equipment. More specific examples of the computerreadable medium include but are not limited to: an electronic connection(an electronic device) with one or more wires, a portable computerenclosure (a magnetic device), a random-access memory (RAM), a read onlymemory (ROM), an erasable programmable read-only memory (EPROM or aflash memory), an optical fiber device and a portable compact diskread-only memory (CDROM). In addition, the computer readable medium mayeven be a paper or other appropriate medium capable of printing programsthereon, this is because, for example, the paper or other appropriatemedium may be optically scanned and then edited, decrypted or processedwith other appropriate methods when necessary to obtain the programs inan electric manner, and then the programs may be stored in the computermemories.

It should be understood that each part of the present disclosure may berealized by the hardware, software, firmware or their combination. Inthe above embodiments, a plurality of steps or methods may be realizedby the software or firmware stored in the memory and executed by theappropriate instructions execution system. For example, if it isrealized by the hardware, likewise in another embodiment, the steps ormethods may be realized by one or a combination of the followingtechniques known in the art: a discrete logic circuit having a logicgate circuit for realizing a logic function of a data signal, anapplication-specific integrated circuit having an appropriatecombination logic gate circuit, a programmable gate array (PGA), a fieldprogrammable gate array (FPGA), etc.

Those skilled in the art shall understand that all or parts of the stepsin the above exemplifying method of the present disclosure may beachieved by commanding the related hardware with programs. The programsmay be stored in a computer readable storage medium, and the programsinclude one or a combination of the steps in the method embodiments ofthe present disclosure when run on a computer.

In addition, each function cell of the embodiments of the presentdisclosure may be integrated in a processing module, or these cells maybe separate physical existence, or two or more cells are integrated in aprocessing module. The integrated module may be realized in a form ofhardware or in a form of software function modules. When the integratedmodule is realized in a form of software function module and is sold orused as a standalone product, the integrated module may be stored in acomputer readable storage medium.

The storage medium mentioned above may be read-only memories, magneticdisks, CD, etc. Although embodiments of the present disclosure have beenshown and described, it would be appreciated by those skilled in the artthat the embodiments are explanatory and cannot be construed to limitthe present disclosure, and changes, modifications, alternatives andvariations can be made in the embodiments without departing from thescope of the present disclosure.

1. An image correction method, comprising: extracting human faceattributes of target regions of respective human faces in an image;acquiring, based on the human face attributes, a first region having ahuman face correction attribute from the target regions; acquiring,based on the human face attributes, a second region having a human faceprotection attribute from the target regions; and performing an imagecorrection on the human face in the first region; and performing a pixelcompensation, based on background pixels of the image, on a blank regiongenerated by the image correction in the first region; wherein thebackground pixels of the image do not comprise any pixel in the secondregion.
 2. The method according to claim 1, wherein the extracting humanface attributes of target regions of respective human faces in an image,comprises: detecting human face frames of the respective human faces inthe image; and demarcating, based on a preset algorithm, the targetregions of the human faces from the respective human face frames;obtaining a human face area of each of the target regions; and obtaininga human-face radial distance of each of the target regions, from acentral point coordinate of each of the human face frames to a centralcoordinate of the image.
 3. The method according to claim 2, wherein theacquiring, based on the human face attributes, a first region having ahuman face correction attribute from the target regions, comprises:comparing the human face area of each of the target regions with apreset first area threshold, and comparing the human-face radialdistance of each of the target regions with a preset first distancethreshold; and determining, based on comparing results, the targetregion corresponding to at least one of the human face area beinggreater than the first area threshold and the human-face radial distancebeing greater than the first distance threshold as the first regionhaving the human face correction attribute.
 4. The method according toclaim 3, wherein the acquiring, based on the human face attributes, asecond region having a human face protection attribute from the targetregions, comprises: comparing the human face area of each of the targetregions with a present second area threshold, and comparing thehuman-face radial distance of each of the target regions with a presentsecond distance threshold, wherein the first area threshold is greaterthan the second area threshold, and the first distance threshold isgreater than the second distance threshold; and determining, based oncomparing results, the target region corresponding to the human facearea less than the first area threshold and greater than the second areathreshold and the human-face radial distance less than the firstdistance threshold and greater than the second distance threshold as thesecond region having the human face protection attribute.
 5. The methodaccording to claim 4, further comprising: determining, based on thecomparing results, the target region corresponding to the human facearea less than the second area threshold and the human-face radialdistance less than the second distance threshold as a third regionhaving a human face background attribute; wherein the performing a pixelcompensation, based on background pixels of the image, on a blank regiongenerated by the image correction in the first region, comprises:performing the pixel compensation, based on pixels in the third regionhaving the human face background attribute around the first region, onthe blank region generated by the image correction in the first region.6. The method according to claim 1, wherein each of the human faceattributes comprises a human face area and a human-face radial distance;wherein the acquiring, based on the human face attributes, a firstregion having a human face correction attribute from the target regions,comprises: comparing the human face area of each of the target regionswith a preset first area threshold, and comparing the human-face radialdistance of each of the target regions with a preset first distancethreshold; and determining, based on comparing results, the targetregion corresponding to at least one of the human face area beinggreater than the first area threshold and the human-face radial distancebeing greater than the first distance threshold as the first regionhaving the human face correction attribute; and wherein the acquiring,based on the human face attributes, a second region having a human faceprotection attribute from the target regions, comprises: comparing thehuman face area of each of the target regions with a present second areathreshold, and comparing the human-face radial distance of each of thetarget regions with a present second distance threshold, wherein thefirst area threshold is greater than the second area threshold, and thefirst distance threshold is greater than the second distance threshold;and determining, based on comparing results, the target regioncorresponding to the human face area less than the first area thresholdand greater than the second area threshold and the human-face radialdistance less than the first distance threshold and greater than thesecond distance threshold as the second region having the human faceprotection attribute.
 7. The method according to claim 6, furthercomprising: determining, based on the comparing results, the targetregion corresponding to the human face area less than the second areathreshold and the human-face radial distance less than the seconddistance threshold as a third region having a human face backgroundattribute; wherein the performing a pixel compensation, based onbackground pixels of the image, on a blank region generated by the imagecorrection in the first region, comprises: performing the pixelcompensation, based on pixels in the third region having the human facebackground attribute around the first region, on the blank regiongenerated by the image correction in the first region.
 8. A terminaldevice, comprising: a memory, a processor, and a computer program storedin the memory and executable by the processor, wherein the processor isconfigured, when executing the computer program, to: extract human faceattributes of target regions of respective human faces in an image;acquire, based on the human face attributes, a first region having ahuman face correction attribute from the target regions; acquire, basedon the human face attributes, a second region with a human faceprotection attribute from the target regions; and perform an imagecorrection on a human face in the first region; and perform a pixelcompensation, based on background pixels of the image, on a blank regiongenerated by the image correction in the first region; wherein thebackground pixels of the image are not any pixel in the second region.9. The terminal device according to claim 8, wherein the processor isconfigured concretely, when executing the computer program, to: detecthuman face frames of the respective human faces in the image, anddemarcate, based on a preset algorithm, the target regions of the humanfaces in the human face frames; obtain a human face area of each of thetarget regions; and obtain a human-face radial distance of each of thetarget regions, from a central point coordinate of each of the humanface frames to a central coordinate of the image.
 10. The terminaldevice according to claim 9, wherein the processor is configuredconcretely, when executing the computer program, to: compare the humanface area of each of the target regions with a preset first areathreshold, and compare the human-face radial distance of each of thetarget regions with a preset first distance threshold; and determine,based on compare results, the target region corresponding to at leastone of the human face area being greater than the first area thresholdand the human-face radial distance being greater than the first distancethreshold as the first region having the human face correctionattribute.
 11. The terminal device according to claim 10, wherein theprocessor is configured concretely, when executing the computer program,to: compare the human face area of each of the target regions with apresent second area threshold, and compare the human-face radialdistance of each of the target regions with a present second distancethreshold; wherein the first area threshold is greater than the secondarea threshold, and the first distance threshold is greater than thesecond distance threshold; and determine, based on compare results, thetarget region corresponding to the human face area less than the firstarea threshold and greater than the second area threshold and thehuman-face radial distance less than the first distance threshold andgreater than the second distance threshold as the second region havingthe human face protection attribute.
 12. The terminal device accordingto claim 11, wherein the processor is configured, when executing thecomputer program, to: determine, based on the compare results, thetarget region corresponding to the human face area less than the secondarea threshold and the human-face radial distance less than the seconddistance threshold as a third region having a human face backgroundattribute; and perform the pixel compensation, based on pixels in thethird region having the human face background attribute around the firstregion, on the blank region generated by the image correction in thefirst region.
 13. The terminal device according to claim 8, wherein eachof the human face attributes comprises a human face area and ahuman-face radial distance; wherein the processor is configuredconcretely, when executing the computer program, to: compare the humanface area of each of the target regions with a preset first areathreshold, compare the human-face radial distance of each of the targetregions with a preset first distance threshold, compare the human facearea of each of the target regions with a present second area threshold,and compare the human-face radial distance of each of the target regionswith a present second distance threshold, wherein the first areathreshold is greater than the second area threshold, and the firstdistance threshold is greater than the second distance threshold;determine, based on compare results, the target region corresponding toat least one of the human face area being greater than the first areathreshold and the human-face radial distance being greater than thefirst distance threshold as the first region having the human facecorrection attribute; and determine, based on compare results, thetarget region corresponding to the human face area less than the firstarea threshold and greater than the second area threshold and thehuman-face radial distance less than the first distance threshold andgreater than the second distance threshold as the second region havingthe human face protection attribute.
 14. The terminal device accordingto claim 13, wherein the processor is configured, when executing thecomputer program, to: determine, based on compare results, the targetregion corresponding to the human face area less than the second areathreshold and the human-face radial distance less than the seconddistance threshold as a third region having a human face backgroundattribute; and perform the pixel compensation, based on pixels in thethird region having the human face background attribute around the firstregion, on the blank region generated by the image correction in thefirst region.
 15. A non-transitory computer readable storage mediumstored with a computer program thereon, wherein the computer program,when is executed by a processor, causes the processor to: extract humanface attributes of target regions of respective human faces in an image;acquire, based on the human face attributes, a first region having ahuman face correction attribute from the target regions; acquire, basedon the human face attributes, a second region having a human faceprotection attribute from the target regions; and perform an imagecorrection on a human face in the first region, and perform a pixelcompensation, based on background pixels of the image, on a blank regiongenerated by the image correction in the first region; wherein thebackground pixels of the image are not any pixel in the second region.16. The non-transitory computer readable storage medium according toclaim 15, wherein the computer program, when is executed by theprocessor, causes the processor to: detect human face frames of therespective human faces in the image, and demarcate, based on a presetalgorithm, the target regions of the human faces in the respective humanface frames; obtain a human face area of each of the target regions; andobtain a human-face radial distance of each of the target regions, froma central point coordinate of each of the human face frames to a centralcoordinate of the image.
 17. The non-transitory computer readablestorage medium according to claim 16, wherein the computer program, whenis executed by the processor, causes the processor to: compare the humanface area of each of the target regions with a present first areathreshold, and compare the human-face radial distance of each of thetarget regions with a present first distance threshold; and determine,based on compare results, the target region corresponding to at leastone of the human face area being greater than the first area thresholdand the human-face radial distance being greater than the first distancethreshold as the first region having the human face correctionattribute.
 18. The non-transitory computer readable storage mediumaccording to claim 17, wherein the computer program, when is executed bythe processor, causes the processor to: compare the human face area ofeach of the target regions with a present second area threshold, andcompare the human-face radial distance of each of the target regionswith a present second distance threshold; wherein the first areathreshold is greater than the second area threshold, and the firstdistance threshold is greater than the second distance threshold; anddetermine, based on compare results, the target region corresponding tothe human face area less than the first area threshold and greater thanthe second area threshold and the human-face radial distance less thanthe first distance threshold and greater than the second distancethreshold as the second region having the human face protectionattribute.
 19. The non-transitory computer readable storage mediumaccording to claim 18, wherein the computer program, when is executed bythe processor, causes the processor to: determine, based on the compareresults, the target region corresponding to the human face area lessthan the second area threshold and the human-face radial distance lessthan the second distance threshold as a third region having a human facebackground attribute; and perform the pixel compensation, based onpixels in the third region having the human face background attributearound the first region, on the blank region generated by the imagecorrection in the first region.
 20. The non-transitory computer readablestorage medium according to claim 15, wherein each of the human faceattributes comprises a human face area and a human-face radial distance;wherein the computer program, when is executed by the processor, causesthe processor to: compare the human face area of each of the targetregions with a preset first area threshold, compare the human-faceradial distance of each of the target regions with a preset firstdistance threshold, compare the human face area of each of the targetregions with a present second area threshold, and compare the human-faceradial distance of each of the target regions with a present seconddistance threshold, wherein the first area threshold is greater than thesecond area threshold, and the first distance threshold is greater thanthe second distance threshold; determine, based on compare results, thetarget region corresponding to at least one of the human face area beinggreater than the first area threshold and the human-face radial distancebeing greater than the first distance threshold as the first regionhaving the human face correction attribute; and determine, based oncompare results, the target region corresponding to the human face arealess than the first area threshold and greater than the second areathreshold and the human-face radial distance less than the firstdistance threshold and greater than the second distance threshold as thesecond region having the human face protection attribute.